/*
 * Text.java
 * 
 * Created on 16.9.2007, 19:10:38
 * 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.possoft.messages;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 *
 * @author mara
 * 
 */
public class Text {    
    
    public static final String ERROR_IN_CONNECTING = "ERROR_IN_CONNECTING";
    public static final String ERROR_NO_NAME = "ERROR_NO_NAME";
    public static final String ERROR_NAME_PRESENT = "ERROR_NAME_PRESENT";
    public static final String ERROR_SERVER_FALL = "ERROR_SERVER_FALL";
    
    public static final String CONNECTED =    "CONNECTED";
    public static final String NOTCONNECTED = "NOTCONNECTED";
    
    public static final String SAVEGAME = "SAVEGAME";
    public static final String LOADGAME = "LOADGAME";
    public static final String REMIZANAVRH = "REMIZANAVRH";
    public static final String PROHRANAVRH = "PROHRANAVRH";      
    public static final String NASTAVENI = "NASTAVENI";
    
    public static final String NADPIS = "NADPIS";
    
    public static final String NAME = "NAME";
    public static final String CONNECT = "CONNECT";
    public static final String IAMCONNECT = "IAMCONNECT";
    public static final String SEZNAM = "SEZNAM";
    public static final String VYZVAT = "VYZVAT";
    public static final String VYZIVACIDIALOG = "VYZIVACIDIALOG";
    public static final String ACCEPT = "ACCEPT";
    public static final String DECLINE = "DECLINE";
    public static final String WAIT_FOR_OPPONENT = "WAIT_FOR_OPPONENT";
    // TODO smajlik
    public static final String ZAMITACI_DIALOG_ZPRAVA = "ZAMITACI_DIALOG_ZPRAVA";
    public static final String ZAMITACI_DIALOG_NADPIS = "ZAMITACI_DIALOG_NADPIS";
    public static final String OTHER_OPPONENT_DIALOG_NADPIS = "OTHER_OPPONENT_DIALOG_NADPIS";
    public static final String OTHER_OPPONENT_DIALOG_ZPRAVA = "OTHER_OPPONENT_DIALOG_ZPRAVA";
    public static final String ERROR_NADPIS = "ERROR_NADPIS";  
    public static final String OK = "OK";
    
    public static final String SEND = "SEND";
    public static final String PESEC_NA_KONCI = "PESEC_NA_KONCI";
    public static final String PROTIVNIK_VYBIRA = "PROTIVNIK_VYBIRA";
    
    public static final String VYHRA = "VYHRA";
    public static final String MAT_VYHRA_MESSAGE = "MAT_VYHRA_MESSAGE";
    public static final String PROHRA = "PROHRA";
    public static final String MAT_PROHRA_MESSAGE = "MAT_PROHRA_MESSAGE";
    public static final String PROHRA_NAVRH = "PROHRA_NAVRH";
    public static final String VZDAL_VYHRA_MESSAGE = "VZDAL_VYHRA_MESSAGE";
    public static final String VZDAL_PROHRA_MESSAGE = "VZDAL_PROHRA_MESSAGE";     
    
    public static final String REMIZA_NAVRH = "REMIZA_NAVRH";
    public static final String YES = "YES";
    public static final String NO = "NO";    
    public static final String REMIZA_DIALOG_NADPIS = "REMIZA_DIALOG_NADPIS";
    public static final String REMIZA_DIALOG_ZPRAVA = "REMIZA_DIALOG_ZPRAVA";
    public static final String REMIZA_RESULT_TITLE = "REMIZA_RESULT_TITLE";
    public static final String REMIZA_RESULT_MESSAGE = "REMIZA_RESULT_MESSAGE";
    public static final String REMIZA_RESULT_NOT_ACCEPT_MESSAGE = "REMIZA_RESULT_NOT_ACCEPT_MESSAGE";    
    
    public static final String SAVE_GAME_BUTTON = "SAVE_GAME_BUTTON";
    public static final String LOAD_GAME_BUTTON = "LOAD_GAME_BUTTON";
    public static final String FILE = "FILE";
    public static final String SEZNAM_ULOZENYCH_SOUBORU = "SEZNAM_ULOZENYCH_SOUBORU";
    public static final String ERROR_SAVE_NAME = "ERROR_SAVE_NAME";
    public static final String ERROR_SAVE_FILE = "ERROR_SAVE_FILE";
    public static final String DELETE = "DELETE";
    public static final String ERROR_DELETE_FILE = "ERROR_DELETE_FILE";
    public static final String LOAD_DIALOG_NADPIS = "LOAD_DIALOG_NADPIS";
    public static final String LOAD_DIALOG_ZPRAVA = "LOAD_DIALOG_ZPRAVA";    
    public static final String NO_SAME_OPPONENT = "NO_SAME_OPPONENT";
    public static final String WAIT_FOR_OPPONENT_FOR_LOAD = "WAIT_FOR_OPPONENT_FOR_LOAD";    
    public static final String LOAD_DIALOG_ZPRAVA_RESULT_DECLINE = "LOAD_DIALOG_ZPRAVA_RESULT_DECLINE";
    public static final String ERROR_LOAD_GAME = "ERROR_LOAD_GAME";
    
    public static final String GAMES = "GAMES";
    
/*  
    Commented because game keys are in their own bundles.
   
    public static final String SACHY = "SACHY";
    public static final String DAMAHRA = "DAMAHRA";
    public static final String PISKVORKY = "PISKVORKY";
    public static final String PADACI_PISKVORKY = "PADACI_PISKVORKY";
*/
    
    public static final String POSLEDNI_TAH= "POSLEDNI_TAH";
    public static final String PESEC = "PESEC";   
    public static final String VEZ = "VEZ";    
    public static final String JEZDEC = "JEZDEC";   
    public static final String STRELEC = "STRELEC";
    public static final String DAMA = "DAMA";
    public static final String KRAL = "KRAL";
    public static final String PRAZDNA = "PRAZDNA";  
    
    public static final String KAMEN = "KAMEN";   
    
    private static final char[] pole1 = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'};
              
    private Text() {}
    
    // vraci vyzivaci hlasku do vyzivaciho dialog boxu
    public static String getVyzvaMessage(String vyzivatel, String gameValue) {
        return PropertiesManager.getInstance().getParameterizedMessageForKey("VYZVA_MESSAGE", null, vyzivatel, gameValue);
    }
    
    // hlaska se zobrazi pokud spadne spojeni s protihracem.
    public static String getErrorOpponentFallMessage(String opponent) {
    	return PropertiesManager.getInstance().getParameterizedMessageForKey("ERROR_OPPONENT_FALL_MESSAGE", null, opponent);
    }
    
    // hlaska zobrazuje kdo je na tahu
    public static String getPlayerNaTahu(String playerName) {
    	return PropertiesManager.getInstance().getParameterizedMessageForKey("PLAYER_NA_TAHU", null, playerName);
    }
    
    // hlaska zobrazujici ze ma nekdo sach
    public static String getSachLabelText(String playerName) {
    	return PropertiesManager.getInstance().getParameterizedMessageForKey("SACH_LABEL_TEXT", null, playerName);
    }
    
    // hlaska zobrazujici ze ma nekdo sach
    public static String getSachMatLabelText(String playerName) {
    	return PropertiesManager.getInstance().getParameterizedMessageForKey("SACH_MAT_LABEL_TEXT", null, playerName);
    }
    
    // hlaska zobrazujici hlasku figurky na poslednim tahu
    public static String getLastTahMessage(String figurkaName, int x1, int y1, int x2, int y2) { 
    	return PropertiesManager.getInstance().getParameterizedMessageForKey("POSLEDNI_TAH_FULL_MESSAGE", null, PropertiesManager.getInstance().getMessageForKey(POSLEDNI_TAH), figurkaName, pole1[x1], String.valueOf(8-y1), pole1[x2], String.valueOf(8-y2));
    }
    
    // vitezna nebo proherni zprava pro hru piskvorky a 4 v rade 
    public static String getPiskvorkyMessage(String pocet, boolean vyhra) {      
    	return vyhra ? PropertiesManager.getInstance().getParameterizedMessageForKey("PISKVORKY_WIN_MESSAGE", null, pocet) : PropertiesManager.getInstance().getParameterizedMessageForKey("PISKVORKY_LOST_MESSAGE", null, pocet);  
    }
    
    // testing purposes.
    public static void main(String[] args) throws IOException {
    	String s1 = PropertiesManager.getInstance().getConfProperty("conf.locale");
    	String s2 = PropertiesManager.getInstance().getMessageForKey("ERROR_IN_CONNECTING");
    	String s3 = PropertiesManager.getInstance().getMessageForKey("NON_EXISTING_KEY");
    	System.out.println(s1);
    	System.out.println(s2);
    	System.out.println(s3);
    }    
    
}
